import axiosReq from './axiosReq.js'
let baseURL = "https://arkphoto.server.zhhost.top"
let ossURL = 'https://arkphoto-file.oss-cn-hangzhou.aliyuncs.com'
const setting = {
    globalUrl: {
        base: baseURL,
        server: baseURL,
        uploadserver: baseURL+"/zh8848/upload",
        upload: baseURL+"/upload",
        fileurl: ossURL
    },
    globalData:{
        configAry: [
            { id:0, text:"计量单位" },
            { id:1, text:"运输方式" },
            { id:2, text:"产品用途" },
            { id:3, text:"材料名称" },
        ],
        sexAry: [
            { id: 0, text: "未知" }, 
            { id: 1, text: "男" }, 
            { id: 2, text: "女" } 
        ],
        stateTypeAry: [ 
            { id: 0, text: "停用" }, 
            { id: 1, text: "正常" } 
        ],
        verifyTypeAry: [ 
            { id: 0, text: "审核中", text_: '审核中', colorType: "warning" }, 
            { id: 1, text: "通过", text_: '通过', colorType: "success" } , 
            { id: 2, text: "未通过", text_: '不通过', colorType: "danger"} 
        ],
        shelvesTypeAry: [ 
            { id: 0, text: "下架", colorType: "danger"}, 
            { id: 1, text: "上架", colorType: "success" }, 
        ],
        type_userTypeAry: [ 
            { id: 1, text: "个人"}, 
            { id: 2, text: "企业"}, 
        ],
        type_identityTypeAry: [ 
            { id: '采购', text: "采购"}, 
            { id: '销售', text: "销售"}, 
        ],
        type_identitySerTypeAry: [
            { id: '', text: "不限"},  
            { id: '采购', text: "采购"}, 
            { id: '销售', text: "销售"}, 
            { id: '销售,销售', text: "销售,销售"}, 
        ],
        problemAry: [
            { id:0, text:"通用问题" },
            { id:1, text:"产品问题" },
            { id:2, text:"企业问题" },
        ],
    },
    getConfig(){
        return new Promise((resovle,rej)=>{
            axiosReq({
                url: '/manager/config/list',
                data: {key:"",type:''},
                bfLoading: true
            }).then(res => {
                let list = res.msg.list||[]
                let config = {}
                list.map(e=>{
                    if(e.isshow){
                        const o = this.globalData.configAry.find(ev => ev.id == e.type)
                        if(config[o.text]){
                            config[o.text].push(e)
                        }else{
                            config[o.text] = [e]
                        }
                    }
                })
                resovle(config||{})
            }).catch(() => {resovle({})})
        })
    },
}
export default setting